cmake_minimum_required(VERSION 3.14)
project(BuildSystemTests)

# 设置C++标准
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 查找必要的包
find_package(GTest REQUIRED)
find_package(Threads REQUIRED)

# 包含目录
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../build_tools)

# 设置测试输出目录
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# 添加测试源文件
set(TEST_SOURCES
    test_main.cpp
    unit_tests/test_build_basic.cpp
    unit_tests/test_build_targets.cpp
    unit_tests/test_feature_config.cpp
    unit_tests/test_prebuilt_libs.cpp
    unit_tests/test_header_libs.cpp
    unit_tests/test_documentation.cpp
    integration_tests/test_build_integration.cpp
    utils/test_utils.cpp
)

# 创建测试可执行文件
add_executable(build_system_tests ${TEST_SOURCES})

# 链接库
target_link_libraries(build_system_tests
    GTest::GTest
    GTest::Main
    Threads::Threads
)

# 启用测试
enable_testing()

# 添加测试
add_test(NAME BuildSystemTests COMMAND build_system_tests)

# 设置测试属性
set_tests_properties(BuildSystemTests PROPERTIES
    TIMEOUT 300
    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
)